<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function aaa(nums) {
      let ans = nums[0], sum = nums[0];
      for (let i = 1; i < nums.length; i++) {
        if (nums[i] > nums[i - 1]) {
          sum += nums[i];
          ans = Math.max(ans, sum);
        } else {
          sum = nums[i];
        }
      }
      return ans;
    };
    console.log(aaa([10, 20, 30, 5, 10, 50]));
  </script>
</body>

</html>